package com.sunnada.edu.system.pub.listener;

import java.util.HashMap;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.sunnada.edu.system.pub.common.Constants;
import com.sunnada.edu.system.pub.util.Utils;

public class SessionListener implements HttpSessionListener {
	public static HashMap sessionMap = new HashMap();

	@Override
	public void sessionCreated(HttpSessionEvent hse) {
		HttpSession session = hse.getSession();
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent hse) {
		HttpSession session = hse.getSession();
		// this.DelSession(session);
	}

	private static synchronized void DelSession(HttpSession session) {
		if (session != null) {
			// 删除单一登录中记录的变量
			String userId = (String) session.getAttribute(Constants.USER_ID_SESSION);
			if (Utils.isNotNull(userId)) {
				// SessionListener.sessionMap.remove(userId);
			}
		}
	}

}
